package com.henry.oddeven;

import java.util.HashSet;
import java.util.Set;

public class OddEvenDemo {
    public static void main(String[] args) throws Exception {
        Odd someOddNumber = new Odd(7);
        Even someEvenNumber = new Even(8);
        Odd anotherOddNumber = new Odd(9);
        Even anotherEvenNumber = new Even(10);
        System.out.println("Even + Even = " + someEvenNumber.add(anotherEvenNumber).getClass());
        System.out.println("Even + Odd  = " + someEvenNumber.add(someOddNumber).getClass());
        System.out.println("Odd  + Odd  = " + someOddNumber.add(anotherOddNumber).getClass());
        System.out.println("Even * Even = " + someEvenNumber.multiply(anotherEvenNumber).getClass());
        System.out.println("Even * Odd  = " + someEvenNumber.multiply(someOddNumber).getClass());
        System.out.println("Odd  * Odd  = " + someOddNumber.multiply(anotherOddNumber).getClass());

        Set<Object> numbers = new HashSet<>();

        numbers.add(someOddNumber);
        numbers.add(someEvenNumber);
        numbers.add(anotherOddNumber);
        numbers.add(anotherEvenNumber);
        numbers.add(new Odd(9));
        numbers.add(new Even(10));

        System.out.println("Numbers in set: " + numbers);
    }
}
